package com.yy.wga.mp.module.file.controller;


import com.yy.wga.mp.common.aop.NotLogin;
import com.yy.wga.mp.module.file.util.OssUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "文件管理")
@RestController
@RequestMapping("/file")
public class FileController {

    @ApiOperation(value = "上传文件")
    @PostMapping("/upload")
    @NotLogin
    public Result<String> upload(@RequestPart("file") MultipartFile file) {
        String url = OssUtils.URL(file);
        Result<String> result = Result.success();
        result.setData(url);
        return result;
    }


}
